package com.tmt.im.jpa.entity;

import com.tmt.data.jpa.entity.TmtBaseRole;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;

import java.io.Serial;
import java.util.List;

/**
 * @Description TODO
 * @Author wuyi
 * @Date 2024/7/18 13:33
 * @Version 1.0
 **/
@Getter
@Setter
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "im_role")
@Tag(name = "im_role", description = "角色表")
public class IMRole extends TmtBaseRole {

    @Serial
    private static final long serialVersionUID = 5778517993320850176L;

    @OneToMany(mappedBy = "role", cascade = {CascadeType.REFRESH}, fetch = FetchType.LAZY)
    private List<IMRoleAuthority> roleAuthorities;

    @OneToMany(mappedBy = "role", cascade = {CascadeType.REFRESH}, fetch = FetchType.LAZY)
    private List<IMUserRole> userRoles;

}
